package com.huo.importdata.controller;

import com.huo.annotation.TaskLogAnnotation;
import com.huo.common.enumtype.FileTypeEnum;
import com.huo.common.enumtype.R;
import com.huo.filestransport.service.FtpService;
import com.huo.filestransport.vo.FtpFileSimpleInfo;
import com.huo.filestransport.vo.FtpServerInfo;
import com.huo.importdata.service.ImportDate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/ftp")
public class ImportController {
	private final Logger logger = LoggerFactory.getLogger(getClass());

	@Autowired
	ImportDate importDate;
	@GetMapping("/importDate")
	public void importDate(String dataDate){
		logger.info("导入数据开始 ：{}",dataDate);
		importDate.importAlldate(dataDate);
		logger.info("导入数据结束 ：{}",dataDate);
	}


	@GetMapping("/importDateBatch")
	public void importDateBatch(){
		logger.info("导入数据开始");
		while (true){
			String str = importDate.importAlldate(null);
			if("1".equals(str)){
				break;
			}
		}
		logger.info("导入数据结束");
	}

}
